/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package org.jackysoft.entity;

import java.util.Collection;







import org.dom4j.Element;
import org.jackysoft.bean.define.EntitySchemas;

/**
 * DOCUMENT ME!
 * 
 * 
 */



public class SplitNode extends AbstractNode {
	// ~ Instance fields
	// ////////////////////////////////////////////////////////

	/**
	 * 
	 */
	private static final long serialVersionUID = -2846928253615190907L;
	protected Collection<ResultNode> results;
	protected boolean team = false;

	// ~ Constructors
	// ///////////////////////////////////////////////////////////

	/**
     * 
     */
	public SplitNode() {
	}

	/**
     * 
     */
	public SplitNode(Element element) {
		super(element);
	}

	@Override
	public Element asElement() {
		Element root = elementof("split");
		attr(root, "team", team);
		addchildren(root, results);
		return root;
	}

	// ~ Methods
	// ////////////////////////////////////////////////////////////////

	
	
	
	
	public Collection<ResultNode> getResults() {
		return results;
	}

	@Override
	protected void init(Element root) {
		this.team = booleanAttr(root, "team");
		this.results = childrenof(root, "unconditional-result",
				ResultNode.class);
	}

	public boolean isTeam() {
		return team;
	}

	/**
	 * 
	 */
	public void setResults(Collection<ResultNode> results) {
		this.results = results;
	}

	public void setTeam(boolean team) {
		this.team = team;
	}

	@Override
	public String tagName() {
		// TODO Auto-generated method stub
		return "split";
	}

}
